package com.skytech.component.monitor.data;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MonitorDataService {

    @Autowired
    private MonitorDataDAO monitorDataDAO;

    @Value("${pageNum}")
    private  int pageSize;

    public Page<MonitorData> findByProvincePage(String province, int pageNum) {
        Pageable pageable = PageRequest.of(pageNum,pageSize);
        return monitorDataDAO.findByProvince(province,pageable);
    }

    public List<MonitorData> findByProvince(String province) {
        return monitorDataDAO.findByProvince(province);
    }
}
